package com.comprehensive.dataservice;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;

import java.util.Collections;

public class CodeGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/personal_comprehensive?useSSL=false&serverTimezone=UTC", "root", "123456")
                // 全局配置
                .globalConfig(builder -> {
                    builder.author("") // 设置作者
                            .outputDir("D:\\PersonalComprehensiveApplicationProject\\PersonalComprehensiveService\\data-access-service\\src\\main\\java"); // 指定输出目录
                })
                // 包配置
                .packageConfig(builder -> {
                    builder.parent("com.comprehensive.dataservice") // 设置父包名
                            .moduleName("") // 设置模块名
                            .pathInfo(Collections.singletonMap(OutputFile.xml, "D:\\PersonalComprehensiveApplicationProject\\PersonalComprehensiveService\\data-access-service\\src\\main\\resources\\mapper")); // 设置mapperXml生成路径
                })
                // 策略配置
                .strategyConfig(builder -> {
                    builder.addInclude("movie_episodes") // 设置需要生成的表名
                            .addTablePrefix("t_", "c_"); // 设置过滤表前缀
                })
                .execute();
    }
}

